<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p {
            position: absolute;
            left: 1000px;
            /* 不换行 */
            white-space: nowrap;
        }
    </style>
</head>

<body>

    <button>发送</button>
    <div class="danMu"></div>


    <script src="../js/move.js"></script>
    <script>

        var oSend = document.querySelector('button');
        var oDanMu = document.querySelector('.danMu');
        oSend.onclick = function () {
            var oP = document.createElement('p');
            oP.innerHTML = '我是弹幕';
            oP.style.top = parseInt(Math.random() * 400);
            oDanMu.appendChild(oP);
            console.log(oP.clientWidth);
            move(oP, 10, -oP.offsetWidth, 'left');
            // setTimeout(function () {
            //     oP.remove()
            // }, 2000)
        }

    </script>

</body>

</html>